<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var myMath = {
            PI: 3.1415926,
            max: function () {
                //将max定义为数字类型
                var max = Number(arguments[0]);
                for (var i = 0; i < arguments.length; i++) {
                    if (max < Number(arguments[i])) {
                        max = Number(arguments[i]);
                    } return max;
                } if (arguments.length == 0) {
                    max = -Infinity;
                    return max;
                }
            },
            min: function () {
                var min = Number(arguments[0]);
                for (var i = 0; i < arguments.length; i++) {
                    if (min > Number(arguments[i])) {
                        min = Number(arguments[i]);
                    } return min;
                }
                if (arguments.length == 0) {
                    min = -Infinity;
                    return min;
                }
            }
        }
        console.log(myMath.PI);
        console.log(myMath.max(1, 5, 9)); // 9
        console.log(myMath.max()); //-infinity
        console.log(myMath.min());//-infinity
        console.log(typeof myMath.max('abc', 11)); //number
        console.log(typeof myMath.min('10', 11));//number
    </script>
</body>

</html>